import java.util.StringTokenizer;

class P10684 {

	private static S1 s;


	public static void main(String[] args) {
		s = new S1();
		int numbers = s.getInt();
		while (numbers != 0) {
			int[] array = new int[numbers];
			for (int k = 0; k < numbers; k++) {
				array[k] = s.getInt();
			}

			long max = -1;

			long sum = 0;

			for (int k = 0; k < numbers; k++) {

				if (sum >= 0) {
					sum += array[k];
				} else {
					sum = array[k];
				}

				if (max < sum) {
					max = sum;
				}

				if (max < array[k]) {
					max = array[k];
				}

			}

			if (max > 0) {
				System.out.println("The maximum winning streak is " + max + ".");
			} else {
				System.out.println("Losing streak.");
			}

			numbers = s.getInt();
		}
	}


	static String readLn() {
		String newLine = System.getProperty("line.separator");
		StringBuffer buffer = new StringBuffer();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {
				buffer.append((char) car);
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString()).trim();
	}

}

class S1 {

	StringTokenizer st = null;


	int getInt() {
		if (st == null)
			st = new StringTokenizer(R1.readLn());
		while (!st.hasMoreTokens())
			st = new StringTokenizer(R1.readLn());
		return Integer.parseInt(st.nextToken());
	}

}

class R1 {
	static String readLn() {
		String newLine = System.getProperty("line.separator");
		StringBuffer buffer = new StringBuffer();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {
				buffer.append((char) car);
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString()).trim();
	}
}
